package com.lineage.data.item_etcitem.add;

import com.lineage.data.executor.ItemExecutor;
import com.lineage.server.model.Instance.L1ItemInstance;
import com.lineage.server.model.Instance.L1PcInstance;
import com.lineage.server.serverpackets.S_SystemMessage;
import com.lineage.server.serverpackets.ServerBasePacket;
import com.lineage.william.Itemup;

public class Item_up extends ItemExecutor {
  public static ItemExecutor get() {
    return new Item_up();
  }
  
  public void execute(int[] data, L1PcInstance pc, L1ItemInstance item) {
    int targObjId = data[0];
    if (targObjId <= 0)
      return; 
    L1ItemInstance item2 = pc.getInventory().getItem(targObjId);
    if (item2 == null)
      return; 
    if (item2.isEquipped()) {
      pc.sendPackets((ServerBasePacket)new S_SystemMessage("请先卸除该装备在升级。"));
      return;
    } 
    Itemup.forresolvent(pc, item, data[0]);
  }
}
